<template>
	<view>
		<!--header-->
		<view class="tui-header-box" :style="{ height: height + 'px', background: 'rgba(255,255,255,' + opcity + ')' }">
			<view class="tui-header" :style="{ paddingTop: top + 'px', opacity: opcity }">我的</view>
			<!-- #ifndef MP -->
			<view class="tui-header-icon" :style="{ marginTop: top + 'px' }">
				<view class="tui-icon-box tui-icon-setup" @tap="goMyBaseInfo()">
					<tui-icon name="setup" :color="opcity > 0.02 ? `rgba(85,85,85,${opcity})` : '#fff'"
						:size="26"></tui-icon>
				</view>
			</view>
			<!-- #endif -->
		</view>
		<!--header-->
		<view class="tui-mybg-box">
			<image src="/static/images/mall/my/img_bg_3x.png" class="tui-my-bg" mode="widthFix"></image>
			<view class="tui-header-center">
				<image :src="myImgLogo" class="tui-avatar" @tap="goMyBaseInfo()"></image>
				<view class="tui-info">
					<view class="tui-nickname">{{ myName }}</view>
					<view class="tui-explain">{{ myPhone }}</view>
					<view class="tui-explain">推荐人: {{ myInfo.push_user_name }}</view>
				</view>
				<!-- #ifndef MP -->
				<view class="tui-btn-edit">
					<tui-button type="white" :plain="true" shape="circle" width="92rpx" height="40rpx" :size="22"
						@click="goMyBaseInfo()">编辑</tui-button>
				</view>
				<!-- #endif -->
				<!-- #ifdef MP -->
				<view class="tui-set-box">
					<view class="tui-icon-box tui-icon-setup" @tap="goMyBaseInfo()">
						<tui-icon name="setup" color="#fff" :size="26"></tui-icon>
					</view>
				</view>
				<!-- #endif -->
			</view>
			<view class="tui-header-btm">
				<view class="tui-btm-item" @tap="goMyBillMoneyList()">
					<view class="tui-btm-num">{{ myInfo.money }}</view>
					<view class="tui-btm-text">余额</view>
				</view>
				<view v-if="myInfo.shop_id != 600" class="tui-btm-item" @tap="goJifenBillList()">
					<view class="tui-btm-num">{{ myInfo.point }}</view>
					<view class="tui-btm-text">积分</view>
				</view>

				<view v-if="myInfo.shop_id == 600" class="tui-btm-item" @tap="goMyJiaMiList()">
					<view class="tui-btm-num">{{ myInfo.jia_mi }}</view>
					<view class="tui-btm-text">佳米</view>
				</view>
				<view v-if="myInfo.shop_id == 600" class="tui-btm-item" @tap="goMyJiaMiDiList()">
					<view class="tui-btm-num">{{ myInfo.point_free }}</view>
					<view class="tui-btm-text">返现累计</view>
				</view>

				<view v-if="myInfo.shop_id == 600" class="tui-btm-item" @tap="goMyCreditScoreList()">
					<view class="tui-btm-num">{{ myInfo.credit_score }}</view>
					<view class="tui-btm-text">Q分</view>
				</view>

				<view class="tui-btm-item">
					<view class="tui-btm-num">{{ myInfo.money_sum }}</view>
					<view class="tui-btm-text">累计消费</view>
				</view>
			</view>
		</view>


		<view class="tui-content-box">
			<view class="tui-box tui-order-box">
				<tui-list-cell :arrow="true" padding="0" :lineLeft="0" @click="goMyOrderIndex(0)">
					<view class="tui-cell-header">
						<view class="tui-cell-title">我的订单</view>
						<view class="tui-cell-sub">查看全部订单</view>
					</view>
				</tui-list-cell>
				<view class="tui-order-list">
					<view class="tui-order-item" @tap="goMyOrderIndex(0)">
						<view class="tui-icon-box">
							<image src="/static/images/mall/my/icon_daifukuan_3x.png" class="tui-order-icon"></image>
							<!-- <view class="tui-badge tui-badge-red">1</view> -->
						</view>
						<view class="tui-order-text">全部</view>
					</view>
					<view class="tui-order-item" @tap="goMyOrderIndex(3)">
						<view class="tui-icon-box">
							<image src="/static/images/mall/my/icon_daifahuo_3x.png" class="tui-order-icon"></image>
							<!-- <view class="tui-badge tui-badge-red">1</view> -->
						</view>
						<view class="tui-order-text">待使用</view>
					</view>
					<view class="tui-order-item" @tap="goMyOrderIndex(1)">
						<view class="tui-icon-box">
							<image src="/static/images/mall/my/icon_daishouhuo_3x.png" class="tui-order-icon"></image>
						</view>
						<view class="tui-order-text">已完成</view>
					</view>
				</view>
			</view>

			<view class="tui-box tui-tool-box">
				<tui-list-cell :arrow="true" padding="0" :lineLeft="0">
					<view class="tui-cell-header">
						<view class="tui-cell-title">常用工具</view>
						<!-- <view class="tui-cell-sub">查看更多</view> -->
					</view>
				</tui-list-cell>
				<view class="tui-order-list-tool tui-flex-wrap">
					<view class="tui-tool-item" @tap="goMyMoneyApply()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_3.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">余额提现</view>
					</view>
					<view class="tui-tool-item" @tap="goMyMoneyApplyList()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_9.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">提现记录</view>
					</view>
					<view v-if="shopId == 88 || shopId == 99" class="tui-tool-item"
						@tap="goPageUrl('/pages/site/term?type=4')()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_5.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">联系客服</view>
					</view>
					<view v-if="shopId == 600" class="tui-tool-item" @tap="goMyJiaMiApply()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_7.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">佳米提现</view>
					</view>
					<view v-if="shopId == 100" class="tui-tool-item" @tap="goShopOpenVip()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_7.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">VIP会员</view>
					</view>
					<view v-if="shopId == 200" class="tui-tool-item" @tap="goShopTicketIndex()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_7.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">我的水票</view>
					</view>
					<view v-if="myInfo.is_shop_admin == 1" class="tui-tool-item" @tap="goShopStat()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_1.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">商家中心</view>
					</view>
					<view v-if="myInfo.is_shop_staff == 1" class="tui-tool-item" @tap="goShopStaffOrder()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_6.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">配送订单</view>
					</view>
					<view v-if="showAuthGoods == 1" class="tui-tool-item" @tap="goShopAuthOrder()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_8.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">商家订单</view>
					</view>
				</view>
			</view>

			<view v-if="false" class="tui-box tui-tool-box">
				<tui-list-cell :arrow="false" padding="0" :lineLeft="0">
					<view class="tui-cell-header">
						<view class="tui-cell-title">积分商城</view>
					</view>
				</tui-list-cell>
				<view class="tui-order-list-tool tui-flex-wrap">
					<view class="tui-tool-item" @tap="goJifenGoodsList()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_7.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">积分商品</view>
					</view>
					<view class="tui-tool-item" @tap="goJifenOrderList()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_2.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">积分订单</view>
					</view>
					<view class="tui-tool-item" @tap="goJifenTransferToMoney()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_11.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">积分转余额</view>
					</view>
					<view class="tui-tool-item" @tap="goJifenTransferToFriend()">
						<view class="tui-icon-box">
							<image src="/static/icons/icon_1.png" class="tui-tool-icon"></image>
						</view>
						<view class="tui-tool-text">积分转好友</view>
					</view>
				</view>
			</view>

			<view class="tui-box tui-assets-box-list">
				<tui-list-view title="菜单列表" class="tui-list-view">
					<tui-list-cell :arrow="false" class="tui-list">
						<tui-icon name="star-fill" :size="24" color="#5677fc"></tui-icon>
						<text class="tui-list-cell-name">会员等级</text>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{ myInfo.level_name
						}}</tui-tag>
					</tui-list-cell>
					<tui-list-cell :arrow="false" class="tui-list">
						<tui-icon name="applets" :size="24" color="#19be6b"></tui-icon>
						<text class="tui-list-cell-name">团队业绩</text>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{
							myInfo.team_money_sum }}</tui-tag>
					</tui-list-cell>
					<tui-list-cell :arrow="false" class="tui-list" @click="goInvitePoster()">
						<tui-icon name="member-fill" :size="24" color="#ff7900"></tui-icon>
						<text class="tui-list-cell-name">我的邀请码</text>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right"
							@click="copyText(myInfo.invite_code)">{{ myInfo.invite_code }}</tui-tag>
					</tui-list-cell>

					<tui-list-cell v-if="shopId != 300" class="tui-list">
						<tui-icon name="wallet" :size="24" color="#ff7900"></tui-icon>
						<view class="tui-list-cell-name">红包基础值</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{
							shopInfo.free_money_min }}元</tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId != 300" class="tui-list">
						<tui-icon name="manage-fill" :size="24" color="#19be6b"></tui-icon>
						<view class="tui-list-cell-name">红包规则</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{
							shopInfo.free_rule_type_name }}</tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId != 300" class="tui-list" @click="goRedEnvelopeRecord()">
						<tui-icon name="redpacket-fill" :size="24" color="#F54847"></tui-icon>
						<view class="tui-list-cell-name">天天红包记录</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{
							billList.length }} 次 </tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId != 300" class="tui-list" :arrow="true" @click="goMyFreePool(0)">
						<tui-icon name="balloon" :size="24" color="#ff4700"></tui-icon>
						<view class="tui-list-cell-name">红包资格次数</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{
							myInfoStat.free_total }} 次 </tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId != 300" class="tui-list" :arrow="true" @click="goMyFreePool(1)">
						<tui-icon name="balloon" :size="24" color="#19be6b"></tui-icon>
						<view class="tui-list-cell-name">已红包次数</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{
							myInfoStat.free_done }} 次 </tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId != 300" class="tui-list" :arrow="true" @click="goMyFreePool(2)">
						<tui-icon name="balloon" :size="24" color="#5677fc"></tui-icon>
						<view class="tui-list-cell-name">待红包次数</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{ myInfoStat.free_yet
						}} 次 </tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId != 300" class="tui-list">
						<tui-icon name="balloon" :size="24" color="#19be6b"></tui-icon>
						<view class="tui-list-cell-name">我的红包资金池</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{ myInfo.money_free
						}}</tui-tag>
					</tui-list-cell>
					<tui-list-cell v-if="shopId == 100" class="tui-list">
						<tui-icon name="balloon" :size="24" color="#ff4700"></tui-icon>
						<view class="tui-list-cell-name">我的红包积分池</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{ myInfo.point_free
						}}</tui-tag>
					</tui-list-cell>
					<tui-list-cell @click="goMyPushMember()" :arrow="true" class="tui-list">
						<tui-icon name="friendadd-fill" :size="24" color="#19be6b"></tui-icon>
						<view class="tui-list-cell-name">我的邀请</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">{{ myInfo.push_cnt
						}}人</tui-tag>
					</tui-list-cell>
					<tui-list-cell @click="goMyAddressIndex()" :arrow="true" class="tui-list">
						<tui-icon name="house" :size="24" color="#19be6b"></tui-icon>
						<view class="tui-list-cell-name">收货地址</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">地址管理</tui-tag>
					</tui-list-cell>
					<tui-list-cell @click="goMyBaseInfo()" :arrow="true" class="tui-list">
						<tui-icon name="setup-fill" :size="24" color="#ff4700"></tui-icon>
						<view class="tui-list-cell-name">我的信息</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">完善信息</tui-tag>
					</tui-list-cell>
					<tui-list-cell @click="goPageUrl('/pages/my/account-list')" :arrow="true" class="tui-list">
						<tui-icon name="exchange" :size="24" color="#5677fc"></tui-icon>
						<view class="tui-list-cell-name">账号管理</view>
						<tui-tag size="small" type="light-green" shape="circle" class="tui-right">账号切换</tui-tag>
					</tui-list-cell>

				</tui-list-view>
			</view>

		</view>

		<tui-modal :show="modalLogout" @click="handleClickLogout" @cancel="hideModalLogout" title="提示"
			content="确定退出登录吗？"></tui-modal>

		<view class="tui-exit" @click="showModalLogout()">
			<tui-button type="primary" height="80rpx" :size="30">退出登录</tui-button>
		</view>
	</view>
</template>

<script>
import footerMenu from "@/components/footer-menu.vue"
import tuiIcon from "@/components/thorui/tui-icon/tui-icon.vue"
import tuiButton from "@/components/thorui/tui-button/tui-button"
import tuiListCell from "@/components/thorui/tui-list-cell/tui-list-cell"
import tuiDivider from "@/components/thorui/tui-divider/tui-divider"
import tuiLoadmore from "@/components/thorui/tui-loadmore/tui-loadmore"
import tuiTag from "@/components/thorui/tui-tag/tui-tag"
import tuiListView from "@/components/thorui/tui-list-view/tui-list-view"
import tuiModal from "@/components/thorui/tui-modal/tui-modal.vue"
export default {
	components: {
		footerMenu,
		tuiIcon,
		tuiButton,
		tuiListCell,
		tuiDivider,
		tuiLoadmore,
		tuiTag,
		tuiListView,
		tuiModal,
	},

	data() {
		return {
			height: 64, //header高度
			top: 0, //标题图标距离顶部距离
			scrollH: 0, //滚动总高度
			opcity: 0,
			iconOpcity: 0.5,

			myInfo: [],
			myId: 0,
			myName: '',
			myPhone: '',
			myImgLogo: '',
			myMoney: 0,
			myCoupon: 0,
			myGold: 0,
			myPushId: 0,
			myCate: 9,
			billList: [],
			myStatPushCnt: 0,
			estimateTotal: 0,


			shopId: 0,
			shopInfo: {},
			myInfoStat: {},
			showAuthGoods: 0,

			modalLogout: false,
		}
	},
	methods: {

		//跳转到指定的URL页面
		goPageUrl: function (pageUrl) {
			uni.navigateTo({
				url: pageUrl
			})
		},


		//我的订单中心
		goMyOrderIndex: function (page) {
			let url = "/pages/my-order/index";
			switch (page) {
				case 1: url = "/pages/my-order/done"; break;
				case 3: url = "/pages/my-order/yet"; break;
				default: break;
			}
			uni.navigateTo({
				url: url
			})
		},

		//我的订单中心
		goMyBaseInfo: function () {
			uni.navigateTo({
				url: '/pages/my/base-info'
			})
		},

		goMySign: function () {
			uni.navigateTo({
				url: '/pages/my/sign'
			})
		},

		goMyCoupon: function () {
			uni.navigateTo({
				url: '/pages/my-coupon/index'
			})
		},

		goMyGoldBill: function () {
			uni.navigateTo({
				url: '/pages/my-gold/bill'
			})
		},

		goMyGoldIndex: function () {
			uni.navigateTo({
				url: '/pages/my-gold/index'
			})
		},

		goMyFreePool: function (e) {
			uni.navigateTo({
				url: '/pages/my/free-pool?status=' + e
			})
		},

		//商家中心
		goShopStat: function () {
			uni.navigateTo({
				url: '/pages/shop/stat'
			})
		},

		//商户管理商品订单
		goShopAuthOrder: function () {
			uni.navigateTo({
				url: '/pages/shop/auth-order'
			})
		},

		//配送订单
		goShopStaffOrder: function () {
			uni.navigateTo({
				url: '/pages/shop/staff-order'
			})
		},



		goMyMoneyApplyList: function () {
			uni.navigateTo({
				url: '/pages/my-money/apply-list'
			})
		},

		goJifenGoodsList: function () {
			this.tui.toast('礼品选品中,即将开放..', 2000, false);
			return;
			uni.navigateTo({
				url: '/pages/jifen/goods-list'
			})
		},
		getBillList: function (type) {
			if (type != 'append') this.pageIndex = 1;
			uni.request({
				url: this.$apiUrl + '/api/user/red_money_list',
				header: {
					'userId': uni.getStorageSync('userId'),
					'userToken': uni.getStorageSync('userToken'),
					'shopId': uni.getStorageSync('shopId')
				},
				data: {
					page_num: this.pageIndex
				},
				success: (res) => {
					this.billList = res.data.data
				}
			});
		},

		goJifenOrderList: function () {
			uni.navigateTo({
				url: '/pages/jifen/order-list'
			})
		},

		goMyPushMember: function () {
			uni.navigateTo({
				url: '/pages/my-push/member'
			})
		},

		goMyTaskMember: function () {
			uni.navigateTo({
				url: '/pages/my-task/member'
			})
		},

		goMyTaskSales: function () {
			uni.navigateTo({
				url: '/pages/my-task/sales'
			})
		},

		goInvitePoster: function () {
			uni.navigateTo({
				url: '/pages/my/invite-poster'
			})
		},

		goMyMoneyPushBill: function () {
			uni.navigateTo({
				url: '/pages/my-money/push-bill'
			})
		},

		goMyMoneyStockBill: function () {
			uni.navigateTo({
				url: '/pages/my-money/stock-bill'
			})
		},

		goMyBillMoneyList: function () {
			uni.navigateTo({
				url: '/pages/my-money/bill-list'
			})
		},

		goJifenBillList: function () {
			uni.navigateTo({
				url: '/pages/jifen/bill-list'
			})
		},

		goMyJiaMiList: function () {
			uni.navigateTo({
				url: '/pages/my-money/jia-mi-bill'
			})
		},
		goMyJiaMiDiList: function () {
			uni.navigateTo({
				url: '/pages/my-money/jia-mi-di/jia-mi-di'
			})
		},

		goMyJiaMiApply: function () {

			//只有创客以上的会员才能佳米提现
			if (this.myInfo.level == 31 || this.myInfo.level == 41 || this.myInfo.level == 51 || this.myInfo.level == 61) {
				uni.navigateTo({
					url: '/pages/my-money/jia-mi-apply'
				})
			} else {
				this.tui.toast('只有创客以上会员才能提现', 2000, false);
			}

		},

		goMyCreditScoreList: function () {
			uni.navigateTo({
				url: '/pages/my-money/credit-score'
			})
		},


		goJifenTransferToMoney: function () {
			uni.navigateTo({
				url: '/pages/jifen/transfer-to-money'
			})
		},

		goJifenTransferToFriend: function () {
			uni.navigateTo({
				url: '/pages/jifen/transfer-to-friend'
			})
		},


		goMyMoneyApply: function () {
			uni.navigateTo({
				url: '/pages/my-money/apply'
			})
		},

		//开通会员
		goShopOpenVip: function () {
			uni.navigateTo({
				url: '/pages/shop/open-vip'
			})
		},

		//我的水票
		goShopTicketIndex: function () {
			uni.navigateTo({
				url: '/pages/shop/ticket-index'
			})
		},

		//联系客服
		goKf: function () {
			window.open(this.$kfUrl);
		},

		goWeLogin: function () {
			uni.navigateTo({
				url: '/pages/we/login'
			})
		},

		goMyBillMoney: function () {
			uni.navigateTo({
				url: '/pages/my-money/bill-list'
			})
		},

		goMyAddressIndex: function () {
			uni.navigateTo({
				url: '/pages/my-address/index'
			})
		},

		goMyRedpackIndex: function () {
			uni.navigateTo({
				url: '/pages/my-redpack/index'
			});
		},



		//调用此方法显示组件
		showModalLogout() {
			this.modalLogout = true;
		},
		//隐藏组件
		hideModalLogout() {
			this.modalLogout = false;
		},
		handleClickLogout(e) {
			let index = e.index;
			if (index === 0) {
				//	this.tui.toast('你点击了取消按钮');
			} else {
				uni.setStorageSync('userId', 0);
				uni.setStorageSync('userToken', '');
				uni.setStorageSync('hasLogin', false);
				uni.navigateTo({
					url: '/pages/my/login'
				});
				//	this.tui.toast('你点击了确定按钮');
			}
			this.hideModalLogout();
		},


		//复制文字
		copyText(inviteCode) {
			let that = this;
			uni.setClipboardData({
				data: inviteCode,
				success: function () {
					that.tui.toast('邀请码复制成功', 2000, false);
				}
			});
		},

		//得到我的个人信息
		getMyBaseInfo: function () {
			uni.request({
				url: this.$apiUrl + '/api/user/baseInfo',
				header: {
					'userId': uni.getStorageSync('userId'),
					'userToken': uni.getStorageSync('userToken'),
					'shopId': uni.getStorageSync('shopId'),
				},
				success: (res) => {
					let resErr = res.data['error'];
					let resMsg = res.data['msg'];
					let resCode = res.data['code'];
					if (resCode == 401) {		//用户未登录
						uni.navigateTo({ url: '/pages/my/login' });
					} else if (resCode == 200) {
						let resData = res.data['data'];
						this.myInfo = resData;
						this.myId = resData.id;
						this.myName = resData.name;
						this.myPhone = resData.phone;
						this.myImgLogo = resData.img_logo;
						this.myMoney = resData.money;
						this.myCoupon = resData.coupon;
						this.myGold = resData.gold;
						this.myPushId = resData.push_id;
						this.myCate = resData.cate;
						let authGoods = resData.auth_goods_ids;
						if (authGoods.length > 0) {
							this.showAuthGoods = 1;
						} else {
							this.showAuthGoods = 0;
						}
					} else {
						this.tui.toast(resMsg, 2000, false);
					}
				}
			});
		},

		//得到商户基本信息
		getShopBaseInfo: function () {
			uni.request({
				url: this.$apiUrl + '/api/shop/baseInfo',
				header: {
					'shopId': uni.getStorageSync('shopId'),
				},
				success: (res) => {
					let resData = res.data['data'];
					this.shopInfo = resData;
				}
			});
		},

		//得到我的个人信息
		getMyInfoStat: function () {
			uni.request({
				url: this.$apiUrl + '/api/user/infoStat',
				header: {
					'userId': uni.getStorageSync('userId'),
					'userToken': uni.getStorageSync('userToken'),
					'shopId': uni.getStorageSync('shopId'),
				},
				success: (res) => {
					let resData = res.data['data'];
					this.myInfoStat = resData;
				}
			});
		},

		//得到我的个人信息
		doCheckLuckShow: function () {
			uni.request({
				url: this.$apiUrl + '/api/order/checkLuckShow',
				header: {
					'userId': uni.getStorageSync('userId'),
					'userToken': uni.getStorageSync('userToken'),
					'shopId': uni.getStorageSync('shopId'),
				},
				success: (res) => {
					let resData = res.data['data'];
					let needShow = resData.need_show || 0;
					let prepayId = resData.prepay_id || 0;
					if (needShow == 1 && prepayId > 0) {
						uni.navigateTo({
							url: '/pages/pay/success?prepay_id=' + prepayId
						})
					}
				}
			});
		},
		goRedEnvelopeRecord: function () {
			uni.navigateTo({
				url: '/pages/my-money/redEnvelopeRecord'
			});
		},

	},

	//页面加载的时候
	onLoad: function (options) {
		let obj = {};
		// #ifdef MP-WEIXIN
		obj = wx.getMenuButtonBoundingClientRect();
		// #endif

		uni.getSystemInfo({
			success: (res) => {
				this.width = obj.left || res.windowWidth;
				this.height = obj.top ? (obj.top + obj.height + 8) : (res.statusBarHeight + 44);
				this.top = obj.top ? (obj.top + (obj.height - 32) / 2) : (res.statusBarHeight + 6);
				this.scrollH = res.windowWidth
			}
		});

		//
		let shopIdUrl = options.shop_id || 0;				//页面链接
		let shopIdSync = uni.getStorageSync('shopId');		//localStorage
		let shopId = shopIdUrl || (shopIdSync || 99);		//优先取页面-再去取缓存-再给默认值
		uni.setStorageSync('shopId', shopId);
		this.shopId = shopId;

		//	this.getMyBaseInfo();
		this.getShopBaseInfo();

	},

	//每次页面显示的时候都会去重新获取一下
	onShow() {
		let shopId = uni.getStorageSync('shopId');
		if (shopId == 88 || shopId == 99 || shopId == 400 || shopId == 211) {
			this.doCheckLuckShow(); //检查是否有需要展示抽奖的预支付的订单--有的话跳转到抽奖页面
		}

		this.getMyBaseInfo();
		this.getMyInfoStat();
		this.getBillList();
	},

	onPageScroll(e) {
		let scroll = e.scrollTop <= 0 ? 0 : e.scrollTop;
		let opcity = scroll / this.scrollH;
		if (this.opcity >= 1 && opcity >= 1) {
			return;
		}
		this.opcity = opcity;
		this.iconOpcity = 0.5 * (1 - opcity < 0 ? 0 : 1 - opcity)
	},

	//上拉刷新页面
	onPullDownRefresh() {
		setTimeout(() => {
			uni.stopPullDownRefresh()
		}, 200)
	},

	//下拉加载更多
	onReachBottom: function () {
		//	this.tui.toast("试试商品搜索的功能吧~")
		return;
	}
}
</script>

<style>
.tui-tabbar {
	width: 100%;
	position: fixed;
	display: flex;
	align-items: center;
	justify-content: space-between;
	z-index: 99999;
	background: #fff;
	height: 100rpx;
	left: 0;
	bottom: 0;
	padding-bottom: env(safe-area-inset-bottom);
}

.tui-header-box {
	width: 100%;
	position: fixed;
	left: 0;
	top: 0;
	z-index: 9998;
}

.tui-header {
	width: 100%;
	font-size: 18px;
	line-height: 18px;
	font-weight: 500;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* #ifndef MP */
.tui-header-icon {
	position: fixed;
	top: 0;
	right: 15px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 32px;
	transform: translateZ(0);
	z-index: 99999;
}

/* #endif */
/* #ifdef MP */
.tui-set-box {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

/* #endif */
.tui-icon-box {
	position: relative;
}

.tui-icon-setup {
	margin-left: 8rpx;
}

.tui-badge {
	position: absolute;
	font-size: 24rpx;
	height: 32rpx;
	min-width: 20rpx;
	padding: 0 6rpx;
	border-radius: 40rpx;
	right: 10rpx;
	top: -5rpx;
	transform: scale(0.8) translateX(60%);
	transform-origin: center center;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.tui-badge-red {
	background: #F74D54;
	color: #fff;
}

.tui-badge-white {
	background: #fff;
	color: #F74D54;
}

.tui-badge-dot {
	position: absolute;
	height: 12rpx;
	width: 12rpx;
	border-radius: 50%;
	right: -12rpx;
	top: 0;
	background: #F74D54;
}

.tui-mybg-box {
	width: 100%;
	position: relative;
}

.tui-my-bg {
	width: 100%;
	display: block;
}

.tui-header-center {
	position: absolute;
	width: 100%;
	height: 128rpx;
	left: 0;
	top: 120rpx;
	padding: 0 30rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
}

.tui-avatar {
	flex-shrink: 0;
	width: 128rpx;
	height: 128rpx;
	border-radius: 64rpx;
	display: block;
}

.tui-info {
	width: 60%;
	padding-left: 30rpx;
}

.tui-nickname {
	font-size: 36rpx;
	font-weight: bold;
	color: #fff;
	display: flex;
	align-items: center;
}

.tui-img-vip {
	width: 100rpx;
	height: 36rpx;
	margin-left: 18rpx;
}

.tui-explain {
	width: 80%;
	font-size: 24rpx;
	font-weight: 400;
	color: #fff;
	opacity: 0.75;
	padding-top: 8rpx;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tui-btn-edit {
	flex-shrink: 0;
	padding-right: 22rpx;
}

.tui-header-btm {
	width: 100%;
	padding: 0 30rpx;
	box-sizing: border-box;
	position: absolute;
	left: 0;
	top: 280rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: #fff;
}

.tui-btm-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.tui-btm-num {
	font-size: 32rpx;
	font-weight: 600;
	position: relative;
}

.tui-btm-text {
	font-size: 24rpx;
	opacity: 0.85;
	padding-top: 4rpx;
}

.tui-content-box {
	width: 100%;
	padding: 0 30rpx;
	box-sizing: border-box;
	position: relative;
	top: -72rpx;
	z-index: 10;
}

.tui-box {
	width: 100%;
	background: #fff;
	box-shadow: 0 3rpx 20rpx rgba(183, 183, 183, 0.1);
	border-radius: 10rpx;
	overflow: hidden;
}

.tui-order-box {
	height: 208rpx;
}

.tui-cell-header {
	width: 100%;
	height: 74rpx;
	padding: 0 26rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.tui-cell-title {
	font-size: 30rpx;
	line-height: 30rpx;
	font-weight: 600;
	color: #333;
}

.tui-cell-sub {
	font-size: 26rpx;
	font-weight: 400;
	color: #999;
	padding-right: 28rpx;
}

.tui-order-list {
	width: 100%;
	height: 134rpx;
	padding: 0 30rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.tui-order-list-tool {
	width: 100%;
	height: 134rpx;
	padding: 0 30rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: left;
}

.tui-order-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.tui-order-text,
.tui-tool-text {
	font-size: 26rpx;
	font-weight: 400;
	color: #666;
	padding-top: 4rpx;
}

.tui-tool-text {
	font-size: 24rpx;
}

.tui-order-icon {
	width: 56rpx;
	height: 56rpx;
	display: block;
}

.tui-assets-box {
	height: 178rpx;
	margin-top: 20rpx;
}

.tui-assets-box-list {
	margin-top: 20rpx;
}

.tui-assets-list {
	height: 84rpx;
}

.tui-assets-num {
	font-size: 32rpx;
	font-weight: 500;
	color: #333;
	position: relative;
}

.tui-assets-text {
	font-size: 24rpx;
	font-weight: 400;
	color: #666;
	padding-top: 6rpx;
}

.tui-tool-box {
	margin-top: 20rpx;
}

.tui-flex-wrap {
	flex-wrap: wrap;
	height: auto;
	padding-bottom: 30rpx;
}

.tui-tool-item {
	width: 25%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	padding-top: 30rpx;
}

.tui-tool-icon {
	width: 64rpx;
	height: 64rpx;
	display: block;
}

.tui-badge-icon {
	width: 66rpx;
	height: 30rpx;
	position: absolute;
	right: 0;
	transform: translateX(88%);
	top: -15rpx;
}

/*为你推荐*/
.tui-product-list {
	display: flex;
	justify-content: space-between;
	flex-direction: row;
	flex-wrap: wrap;
	box-sizing: border-box;
}

.tui-product-container {
	flex: 1;
	margin-right: 2%;
}

.tui-product-container:last-child {
	margin-right: 0;
}

.tui-pro-item {
	width: 100%;
	margin-bottom: 4%;
	background: #fff;
	box-sizing: border-box;
	border-radius: 12rpx;
	overflow: hidden;
}

.tui-pro-img {
	width: 100%;
	display: block;
}

.tui-pro-content {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-sizing: border-box;
	padding: 20rpx;
}

.tui-pro-tit {
	color: #2e2e2e;
	font-size: 26rpx;
	word-break: break-all;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.tui-pro-price {
	padding-top: 18rpx;
}

.tui-sale-price {
	font-size: 34rpx;
	font-weight: 500;
	color: #e41f19;
}

.tui-factory-price {
	font-size: 24rpx;
	color: #a0a0a0;
	/* text-decoration: line-through; */
	padding-left: 12rpx;
}

.tui-pro-pay {
	padding-top: 10rpx;
	font-size: 24rpx;
	color: #656565;
}

.tui-list {
	display: flex;
	align-items: center;
	flex-direction: row;
	flex-wrap: nowrap;
	justify-content: flex-start;
	align-content: baseline;
}

/* justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly; */

.tui-right {
	margin-left: auto !important;
	margin-right: 26rpx !important;
	font-size: 26rpx;
	line-height: 26rpx;
	color: #999;
}

.tui-list-cell-name {
	padding-left: 20upx;
	vertical-align: middle;
	line-height: 30upx;
}


.tui-exit {
	width: 88%;
	text-align: center;
	margin: 50rpx auto;
	padding-bottom: 300rpx;
}
</style>